import router from '@/router'
/**
* @author 小C
* @description 全局工具
*/
// 路由跳转
const push = (path) => {
    router.push({
        path
    })
}
const replace = (path)=>{
    router.replace({
        path
    })
}
/* 监听浏览器返回 
 *
 *
 *
 */
const inBroBack = function (fn) {
    if (window.history && window.history.pushState) {
        history.pushState(null, null, document.URL);
        window.addEventListener('popstate', fn, false);
    }
}
/* 
*
*
@props(fn) 监听的函数
**/
const unFunction = function (fn) { 
    window.removeEventListener('popstate', fn, false);
}


export default {
    push,
    replace,
    inBroBack,
    unFunction,
}
